package com.xuecheng.learning.feignclient;

import com.xuecheng.content.model.po.Teachplan;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class TeachplanClientFactory implements FallbackFactory<TeachplanClient> {
    @Override
    public TeachplanClient create(Throwable throwable) {
        return new TeachplanClient() {
            @Override
            public Teachplan getById(Long id) {
                log.error("调用内容管理服务查询课程计划发生熔断:{}",throwable.toString(),throwable);
                return null;
            }
        };
    }
}
